<?php
class annonce_melanger extends MX_Controller{
	public function category($category_id){
		$ids=$this->model()->get_all_product($category_id);
		if(!empty($ids))
			foreach ($ids as $id) {
				$rand_day = array_rand(range(1,7));
				$day="-$rand_day day";
				foreach (range(1,12) as $hour)
					$in_12h[]=$hour*3600;
				$rand_hour=array_rand($in_12h);
				$rand_min=array_rand($min=range(1,3600));
				$date=strtotime($day)+$in_12h[$rand_hour]+$min[$rand_min];
				
				$this->model()->update_date($id->prd_id,$date);
			};
	}
}